// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
//import VueRouter from 'vue-router'
import App from './App'


import router from "./router"
import '../static/libs/font-awesome/css/font-awesome.min.css'

//导入Vuex 仓库
import axios from 'axios'
import store from './store' 
import { mapState, mapGetters } from 'vuex'
FastClick.attach(document.body)

/* eslint-disable no-new */

//Vue.filter('cate',function(value){
//	return '22';
//})
new Vue({
  router,
  store,
  render: h => h(App),
 
  methods:{
  	checkLogin(){
      axios.get("/seller/checkLogin").then(res=> {
//      console.log(res.data)
        this.$store.commit('updateSeller',res.data.data);
this.$store.commit('updateCategory',res.data.cates);
        
      }).catch(function(err){
      	console.log(err);
//    	console.log('111')
      });
    },
    checkBullerLogin(){
      axios.get("/buller/checkLogin").then(res=> {
//      console.log(res.data)
        this.$store.commit('updateBuller',res.data.data);
this.$store.commit('updateShopCar',res.data.shopCar);
        
      }).catch(function(err){
      	console.log(err);
//    	console.log('111')
      });
    },
  },
  mounted(){
  	this.checkLogin();
  	this.checkBullerLogin();
  },
  computed:{
  	...mapGetters([
				'updateSeller'
			])
  }
}).$mount('#app')
//可以通过el属性，将实例挂载到DOM树上，
//也可以用new Vue().$mount('#app')，手动将实例挂载在DOM上
